package com.quasar.hpatient.module.mine_file;

import com.quasar.hpatient.R;
import com.quasar.hpatient.api.HttpClient;
import com.quasar.hpatient.api.HttpParams;
import com.quasar.hpatient.bean.home_inspection.CalendarBean;
import com.quasar.hpatient.dialog.CalendarDialog;

import java.util.HashMap;
import java.util.List;

import io.reactivex.Observable;
import lib.quasar.base.frame.BasePresenter;
import lib.quasar.base.frame.OnModelAcceptChangeListener;
import lib.quasar.context.BaseApp;
import okhttp3.RequestBody;

/**
 * description: 我 ==> 我的档案
 * created by kalu on 2018/4/2 10:54
 */
public class MineFilePresenter implements BasePresenter {

    final void schemelList(CalendarDialog dialog, String year, String month, String minDay, String maxDay) {

        final HashMap<String, Object> map = new HashMap<>();
        map.put(BEGIN_DATE, BaseApp.getResource().getString(R.string.date_calendar, year, month, minDay));
        map.put(END_DATE, BaseApp.getResource().getString(R.string.date_calendar, year, month, maxDay));

        final RequestBody params = createParams(map, HttpParams.DATA_TYPE_4_10);
        final Observable observable = HttpClient.getSingleHolder().getHttpService().schemeList(params);

        request(observable, new OnModelAcceptChangeListener<List<CalendarBean>>() {
            @Override
            public void modelSucc(List<CalendarBean> list) {
                dialog.getCalendarView().setScheme(list);
            }
        });
    }

    @Override
    public void recycler() {
    }
}
